﻿/**
* ...
* @author Default
* @version 0.1
*/

package bdz.common.model {
	import flash.utils.Dictionary;
	
	public class CacheModel extends Dictionary {
		private static var instance:CacheModel;
		private static var cache:Dictionary;
		function CacheModel(paccess:PrivateAccess){
			if(paccess == null){
				throw new Error("Invalid instantiation of a singleton class...");
			}
		}
		public static function getModel():CacheModel{
			if(instance == null){
				instance = new CacheModel(new PrivateAccess());
				cache = new Dictionary();
			}
			return instance;
		}
		public function addCacheData(key:String, value:*):void{
			cache[key] = value;
		}
		public function getCacheData(key:String):*{
			try{
				return cache[key];
			}catch(e:Error){
				return null;
			}
		}
	}
	
}
class PrivateAccess {}